using UnityEngine;
using System.Collections;

public class LayerRay {
	
	private Vector3 origin, direction;
	private RaycastHit hit;
	private int layer;

	public LayerRay(Vector3 origin, Vector3 direction, int layer) {
		this.origin 	= origin;
		this.direction 	= direction;
		this.layer		= layer;
	}
	
	public bool raycast() {
		return raycast(100000f);
	}
	
	public bool raycast(float maxDist) {
		return Physics.Raycast(origin, direction, out hit, maxDist, 
			(1 << layer)
		);
	}
	
	public Vector3 getOrigin() {
		return origin;
	}
	
	public Vector3 getDirection() {
		return direction;
	}
	
	public int getLayer() {
		return layer;
	}
	
	public RaycastHit getHit() {
		return hit;
	}
}
